perm filename PRETTY.DOC[S1,ALS] blob sn#438976 filedate 1979-05-08 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	     	PRETTY: Pascal PrettyPrinting Program
C00013 ENDMK
CāŠ—;
     	PRETTY: Pascal PrettyPrinting Program
		      January 1979


INTRODUCTION

     The PRETTY program takes Pascal source files and inserts spaces
and carriage returns so as to make them conform to certain formatting
conventions.  PRETTY retains any spaces or carriage returns contained
in the original source file.  Hence, no lines ever get moved to the
left as a result of formatting and any special formatting the user
has done remains unchanged as long as it places text farther to the
right than PRETTY requires.

     The user may request, as an option, that all leading blanks be
removed except before comments (PRETTY prompts for this option).  This
has the effect of placing all non-comment text as far left as the
formatting conventions allow.

      The user may also request that PRETTY capitalize all Pascal
reserved words.


FORMATTING CONVENTIONS

     The current formatting conventions are as follows (taken from
the source of PRETTY).


                                                                    
  [ General PrettyPrinting Rules ]                                  
                                                                    
   1.   Any spaces or blank lines beyond those generated by the     
     PrettyPrinter are left alone.  The user is encouraged, for the 
     sake of readability, to make use of this facility.             
        In addition, comments are left where they are found, unless 
     they are shifted right by preceding text on a line.            
                                                                    
   2.   All declarations and all "FOR", "WHILE", "WITH", and "LOOP" 
     statements begin on separate lines.                            
                                                                    
   3.   No line may be greater than 128 characters long.  Any line  
     longer than this is continued on a separate line.              
                                                                    
   4.   The keywords "BEGIN", "END", "REPEAT", and "RECORD" are     
     forced to stand on lines by themselves (or possibly follwed by 
     supporting comments).                                          
        In  addition, the "UNTIL" clause of a "REPEAT-UNTIL" state- 
     ment is forced to start on a new line.                         
                                                                    
   5.   A blank line is forced before the keywords "PROGRAM",       
     "PROCEDURE", "FUNCTION", "LABEL", "CONST", "TYPE", and "VAR".  
                                                                    
   6.   A space is forced before and after the symbols ":=" and     
     "="  additionally, a space is forced after the symbol ":".    
                                                                    
                                                                    
  [ indentation rules ]                                             
                                                                    
   1.   The bodies of "LABEL", "CONST", "TYPE", and "VAR" declara-  
     tions are indented from their corresponding declaration header 
     keywords.                                                      
                                                                    
   2.   The bodies of "BEGIN-END", "REPEAT-UNTIL", "FOR", "WHILE",  
     "WITH", and "CASE" statements, as well as "RECORD-END" struc-  
     tures and "CASE" variants (to one level) are indented from     
     their header keywords.                                         
                                                                    
   3.   An "IF-THEN-ELSE" statement is indented as follows:         
                                                                    
             IF <expression>                                        
                THEN                                                
                   <statement>                                      
                ELSE                                                
                   <statement>                                      
     however, none of the line breaks illustrated is required.      
                                                                    
   4.   A sequence of "IF-THEN-ELSE IF-THEN-ELSE IF..." is indented 
                                                                    
              IF <expression>                                       
                 THEN                                               
                    <statement>                                     
              ELSE IF <expression>                                  
                 THEN                                               
                    . . .                                           
                 ELSE                                               
                    <statement>                                     
                                                                    
     each "ELSE IF" appears on a new line.  The "ELSE" and the "IF" 
     should appear on the same line in the input source text.       
                                                                    
   5.   A sequence of "IF-THEN " is indented                   
                                                                    
              IF <expression>                                       
                 THEN IF <expression> ...                           
                    THEN                                            
                       <statement> ....                             
                                                                    
     each "THEN IF" appears on a new line.  The "THEN" and the "IF" 
     should appear on the same line in the source text.             


RUNNING PRETTY

     To use PRETTY, run it from monitor level with the command

	@<PH0Q>PRETTY

The program will prompt for input and output files.  File name
recognition will not work at this point.  If you choose the name of the
output file to be the same as that of the input file, you will be asked
to confirm that you want the output file deleted.



ACKNOWLEDGEMENTS

     PRETTY was written by H. Ledgard and J. Hueras of the University
of Massachusetts.  P. N. Hilfinger of CMU modified it to run on the
TOPS-10 and TOPS-20 operating systems and the CMU version of Pascal.
The latter also made some modifications in the formatting conventions.
Additional modifications by Michael E. Fryd.

     PRETTY is currently unsupported.  Send suggestions to <PH0Q>.